<?php
/**
 * TestGuest Version1.0
 * ================================================
 * Copy 2017-2018 zxj
 * Web: http://www.zhaoxiaojie.club
 * ================================================
 * Author: Zxj
 * Date: 17/8/11
 * Time: 上午9:43
 * 处理新闻热点请求id,并渲染数据到新闻热点详情页
 *
 */
session_start();
//设置响应头
header('content-type:text/html;charset=utf-8');

if(!empty($_GET['id'])){

    $id = intval($_GET['id']);

    //连接数据库
    include 'common/mysql.inc.php';

    //获取当前新闻数据
    $sql = "select * from bbs_news WHERE id='$id'";
    $res1 = mysql_query($sql);
    $row = mysql_fetch_assoc($res1);


    //获取热门新闻数据
    $sql = "select * from bbs_news ORDER BY id DESC limit 10";
    $res2 = mysql_query($sql);

    while($rows = mysql_fetch_assoc($res2)){

           $data[] = $rows;

    }


    //引入视图文件,然后渲染数据
    include VIEW.'/news.html';

}else{

    _alert_back('参数不正确!');

}



?>